package com.powerdata.core.paimon.enums;

import org.apache.paimon.types.*;


public enum PaimonBaseType {

    STRING(new VarCharType(100)),
    FLOAT(new FloatType()),
    DOUBLE(new DoubleType()),
    LONG(new BigIntType()),
    INTEGER(new IntType()),
    BOOLEAN(new BooleanType()),
    DATE(new DateType()),
    ;


    public DataType type;

    PaimonBaseType(DataType type) {
        this.type = type;
    }


    public DataType getType() {
        return type;
    }

    public void setType(DataType type) {
        this.type = type;
    }

    public static PaimonBaseType getType(String name) {
        try {
            if ((name = name.trim()).startsWith("int")) {
                name = "integer";
            }
            return PaimonBaseType.valueOf(name.toUpperCase());
        } catch (Exception e) {
            return null;
        }

    }

}
